<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        body {
            margin: 0;
        }

        .wrap {
            width: 200px;
            height: 200px;
            padding: 200px;
            border: 1px solid #ccc;
            margin: 0 auto;
            perspective: 800px;
        }

        .box {
            width: 200px;
            height: 200px;
            position: relative;
            transform-style: preserve-3d;
            transition: all 1s;
            transform-origin: center center;
            transform: translateZ(-100px);
        }

        .wrap:hover .box {
            transform: translateZ(-100px) rotateX(180deg);
        }

        .box div {
            position: absolute;
            width: 100%;
            height: 100%;
            line-height: 200px;
            text-align: center;
            font-size: 80px;
            color: #fff;
            left: 0;
            top: 0;
            opacity: 0.5;
        }

        .box div:nth-child(1) {
            background-color: darkorange;
            transform-origin: top;
            transform: translateZ(-100px) rotateX(90deg);
        }
        .box div:nth-child(2) {
            background-color: #d43f3a;
            transform-origin: left;
            transform: translateZ(-100px) rotateY(-90deg);
        }
        .box div:nth-child(3) {
            background-color: aquamarine;
            transform: translateZ(100px);
        }
        .box div:nth-child(4) {
            background-color: blueviolet;
            transform-origin: right;
            transform: translateZ(-100px) rotateY(90deg);
        }
        .box div:nth-child(5) {
            background-color: darkkhaki;
            transform-origin: bottom;
            transform: translateZ(-100px) rotateX(-90deg);
        }
        .box div:nth-child(6) {
            background-color: pink;
            transform: translateZ(-100px) rotateX(180deg);
        }
    </style>
</head>
<body>
<div class="wrap">
    <div class="box">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
    </div>
</div>
</body>
</html>